import { createRouter, createWebHistory } from "vue-router"

import Home from '../views/Home.vue'
import Classified from '../views/Classified.vue'
import My from '../views/My.vue'
import Shopping from '../views/Shopping.vue'

// VITE 自动替换 获取环境变量
const base = import.meta.env.VITE_BASE_URL || '/'

const router = createRouter({
    history: createWebHistory(base),
    routes: [
        {
            path: '/',
            redirect: 'home'
        },
        {
            path: '/home',
            name: 'Home',
            component: Home
        },
        {
            path: '/shopping',
            name: 'Shopping',
            component: Shopping
        },
        {
            path: '/classified',
            name: 'Classified',
            component: Classified
        },
        {
            path: '/my',
            name: 'My',
            component: My
        },
    ]
})

export default router